Skip to content

Conversation

@IntegratedQuantum
Copy link
Member

This moves handling of the creative inventory entirely to the client side, there is no need to have server side resources and logic for it.

In the future we should also apply the same logic to the inventory crafting inventories (which currently suffer from delay on load because they rely on the server to fill the items), but that will require a separate sync command. @Wunka since you already worked on the crafting part in #2483 maybe you would like to work on that?

@IntegratedQuantum IntegratedQuantum changed the title Create a separate ClienInventory type and move some of the functionality from the sync system into it Create a separate ClientInventory type and move some of the functionality from the sync system into it Jan 18, 2026
@Wunka
Copy link
Contributor

Wunka commented Jan 18, 2026

so... maybe something like:

const CraftFromInventory = struct {
	dest: InventoryAndSlot,
	item: Item,
	amount: u16 = 1,
	sources: []const InventoryAndSlot

?
The workbench would then be client side and the client would only send what it wants to craft and what sources to use and where it should go. Maybe we could even send which recipe to use so the server doesn't have to figure it out itself. But I don't know if we can be sure that the client / server list of recipes will be in the same order (if we go by index).

@Wunka
Copy link
Contributor

Wunka commented Jan 18, 2026

or maybe:

const CraftFrom = struct {
	destinations: []const Inventory,
	item: Item,
	amount: u16 = 1,
	source: Inventory // for the future maybe also directly []Inventory

@IntegratedQuantum
Copy link
Member Author

or simpler:

Yeah I'd prefer that, the explicit slots would be too fragile I think.

But I don't know if we can be sure that the client / server list of recipes will be in the same order (if we go by index).

The index is not stable, but you can just send the whole thing, if it ever becomes a performance problem, we can just turn the linear search into a hashmap.

@IntegratedQuantum IntegratedQuantum merged commit a8ce220 into PixelGuys:master Jan 19, 2026
1 check passed
IntegratedQuantum added a commit that referenced this pull request Jan 28, 2026
…ies client side only (#2506)

Extracted from:
#2500 (comment)

Fixes: #2497

- [ ] fix the check for `deserialize` (As already mentioned in
#2469 (comment) I am
not that knowledgable on the reader code so if anybody has a better idea
here, it would be very welcome)
- [x] find out if any mechanic was removed (what scenario made Drop call
tryCrafting?)

This PR also replaces #2483 as its features are also done here.
`CraftFrom` accepts as source a slice to prepare for #2324 or/and making
the user able to craft from items in a chest

---------

Co-authored-by: IntegratedQuantum <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants